from flask import Flask,request
from flask import render_template
from reserch import reserch4letters

app = Flask(__name__)

@app.route('/',methods=['GET'])
def webtop():
    return render_template('webtop.html')

@app.route('/nameindex',methods=['GET'])
def name_index():
    return render_template('name_index.html')

@app.route('/nameresult',methods=['POST'])
def name_result():
    py_firstname = request.form['firstname']
    py_lastname = request.form['lastname']
    py_fullname = py_firstname.title()+' '+py_lastname.title()
    return render_template('name_result.html',
                           fullname = py_fullname)

@app.route('/wordindex',methods=['GET'])
def word_index():
    return render_template('word_index.html')

@app.route('/wordresult',methods=['POST'])
def word_result():
    py_word = request.form['word']
    py_vowels = request.form['vowels']
    py_found = reserch4letters(py_vowels, py_word)

    return render_template('word_result.html',
                           found=py_found)


@app.route('/shopentry',methods=['GET'])
def user_input():
    return render_template('shop_entery.html')

@app.route('/entryresult',methods=['GET','POST'])
def entry_result():
    return render_template('entry_result.html')

@app.route('/kecbiao', methods=['GET'])
def kcb_result():
    return render_template('kecbiao.html')

if __name__ == '__main__':
    app.run(host='127.0.0.1',port=5000,debug=True)
